<!DOCTYPE html>
<html lang="zh-CN" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
      layout:decorator="layout/default" xmlns:th="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    <title>邮件服务器管理</title>
    <link th:href="@{/assets/css/emailConf.css}" rel="stylesheet"/>
    <!--[if lt IE 10]>
    <link th:href="@{/assets/css/ie.css}" rel="stylesheet" type="text/css"/>
    <![endif]-->
    <script>
        function page(n, s) {
            $("#pageNo").val(n);
            $("#pageSize").val(s);
            $("#userSearchForm").submit();
            return false;
        }

        function gotoCreate() {
            window.location.href = '[[@{/email/createSkip}]]';
        }
    </script>
</head>
<body>
<div layout:fragment="content" th:remove="tag">
    <div th:replace="fragments/tool :: tipMessage (type='',content=${message})" th:remove="tag"></div>
    <div class="row">
        <div class="col-md-12">
            <!-- BEGIN PAGE TITLE & BREADCRUMB-->
            <ul class="page-breadcrumb breadcrumb">
                <li class="btn-group" shiro:has-permission="sys:email:add">
                    <button type="button" class="btn blue dropdown-toggle"
                            onclick="gotoCreate()"
                            data-delay="1000" data-close-others="true">
                        <span> + 创建邮件服务器</span>
                    </button>
                </li>
                <li>
                    <i class="fa fa-home"></i>
                    <a th:href="@{/}">首页</a>
                    <i class="fa fa-angle-right"></i>
                </li>
                <li>
                    <a href="#">配置管理</a>
                    <i class="fa fa-angle-right"></i>
                </li>
                <li><a href="#">邮件服务器管理</a></li>
            </ul>
            <!-- END PAGE TITLE & BREADCRUMB-->
        </div>
    </div>

    <div class="row profile">
        <div class="col-md-12">
            <!--BEGIN TABS-->
            <div class="tabbable tabbable-custom tabbable-full-width">
                <div class="tab-content">
                    <div class="tab-pane active" id="user_tab_1_1" th:if="${not #lists.isEmpty(page.list)}">
                        <form id="userSearchForm"
                              th:action="@{/email}" method="post"
                              class="form-inline">
                            <input id="pageNo" name="pageNo" type="hidden" th:value="${page.pageNo}"/>
                            <input id="pageSize" name="pageSize" type="hidden" th:value="${page.pageSize}"/>
                            <input id="orderBy" name="orderBy" type="hidden" th:value="${page.orderBy}"/>
                        </form>
                        <div class="table-responsive">
                            <table class="table table-striped table-bordered table-advance table-hover table-ie">
                                <thead>
                                <tr>
                                    <th class="td-minw-1 th-ie">序列</th>
                                    <th class="td-minw-2">所属机构</th>
                                    <th class="td-minw-3">企业邮件账号</th>
                                    <th class="td-minw-4">邮件主题</th>
                                    <th class="td-minw-5">端口号</th>
                                    <th class="td-minw-6">服务器地址</th>
                                    <th class="td-minw-7">操作</th>
                                </tr>
                                </thead>
                                <tbody>
                                <tr th:each="emailInfo , stat : ${page.list}">
                                    <td th:text="(${page.pageNo} - 1) * ${page.pageSize} + 1 + ${stat.index}">1</td>
                                    <td class="text-leave-out max-real-name" th:text="${emailInfo.organization}"
                                        th:title="${emailInfo.organization}">
                                        novunda
                                    </td>
                                    <td class="text-leave-out max-email-name" th:title="${emailInfo.email}">
                                        <th:block th:text="${emailInfo.email}"></th:block>
                                    </td>
                                    <td class="text-leave-out max-email-name" th:title="${emailInfo.emailTheme}"
                                        th:text="${emailInfo.emailTheme}">mobile
                                    </td>
                                    <td th:text="${emailInfo.port}">companyName</td>
                                    <td class="text-leave-out max-real-name" th:text="${emailInfo.serversAddress}"
                                            th:title="${emailInfo.serversAddress}">
                                        officeName
                                    </td>
                                    <td>
                                        <a th:href="@{/email/ude(id = ${emailInfo.id})}"
                                           th:if="!${emailInfo.defaultEmail}"
                                           shiro:has-permission="sys:email:edit"
                                           onclick="return App.confirm('设置成默认邮件吗？',this.href)"
                                           class="btn default btn-xs green-stripe">默认邮件</a>
                                        <a th:if="${emailInfo.defaultEmail}"
                                           class="btn default btn-xs green-stripe">已默认</a>
                                        <a class="btn default btn-xs blue-stripe"
                                           shiro:has-permission="sys:email:edit"
                                           th:href="@{/email/get(id = ${emailInfo.id})}">修改</a>
                                        <a class="btn default btn-xs red-stripe"
                                           shiro:has-permission="sys:email:delete"
                                           th:href="@{/email/delete(id = ${emailInfo.id})}"
                                           onclick="return App.confirm('确认要删除该邮件配置吗？', this.href)">删除</a>
                                    </td>
                                </tr>
                                </tbody>
                            </table>
                        </div>

                        <div class="row margin-top-20">
                            <th:block th:utext="${page}"/>
                        </div>
                    </div>
                    <div class="row" th:if="${#lists.isEmpty(page.list)}">
                        <div class="col-md-12 null-logo">
                            <div><img th:src="@{/assets/img/custom/nullLogo.png}"></div>
                            <div><label class="null-text-c">没有创建的邮件服务器</label></div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
</html>
